# json测试
import json

json_str = '{"name":"张三","age":18,"sex":"male"}'
j=json.loads(json_str)
print(type(j))
print(j)

# json内部符号，只能是双引号，单引号无法识别
list_str='[{"name":"老周","age":27},{"name":"武大","age":45}]'
l=json.loads(list_str)
print(type(l))
print(l)

list1=[{"name":"老周","age":27},{"name":"武大","age":45}]
list_json=json.dumps(list1,ensure_ascii=False)
print(type(list_json))
print(list_json)

dict1={"name":"老周","age":27}
dict_json=json.dumps(dict1,ensure_ascii=False)
print(type(dict_json))
print(dict_json)